#include"duilie.h"

linkqueue_t *create_linkqueue(void)
{
	linkqueue_t *q = (linkqueue_t *)malloc(sizeof(linkqueue_t));
	q->front = q->rear = (linklist_t *)malloc(sizeof(linklist_t));
	q->front->cangku1 = {0};
	q->front->next = NULL;
	return q;
}

int is_empty_linkqueue(linkqueue_t *q)
{
	return (q->front == q->rear);
}

int in_linkqueue(linkqueue_t *q, cangku x)
{
	linklist_t *node = (linklist_t *)malloc(sizeof(linklist_t));
	node->cangku1 = x;
	node->next = NULL;

	q->rear->next = node;
	q->rear = node;
	return 1;
}

 cangku out_linkqueue(linkqueue_t *q)
{
	if(is_empty_linkqueue(q))
	{
		puts("q is empty");
		exit(1);
	}
	linklist_t *del = q->front;
	q->front = q->front->next;
	free(del);
	del = NULL;
	 cangku ret = q->front->cangku1;
	return ret;
}
cangku out_nodel(linkqueue_t *q)
{
	if(is_empty_linkqueue(q))
	{
		puts("q is empty");
		exit(1);
	}
	cangku ret = q->rear->cangku1;
	return ret;
}



